import { FormItemRule } from "naive-ui";
/**
 * 增加表单配置
 */
export const addFormConfig: Record<string, any> = {
  cols: 24,
  xGap: 24,
  labelPlacement: 'left',
  labelWidth: 80,
  formItems: [
    {
      field: "TYPE",
      labelName: "类别",
      labelStyle: "fontSize:14px;",
      type: "Input",
      inputType: "text",
      inputWidth: "180px",
      placeholder: "请输入类别",
      span:24
    },
  ],
  rules: {
    TYPE: {
      required: true,
      trigger: ["input"],
      message: "请输入类别",
      validator(rule: FormItemRule, value: string) {
        if (value.length === 0) {
          return new Error("未输入类别");
        }
        return true;
      },
    },

  },
};


/**
 * 修改表单配置
 */
export const updateFormConfig: Record<string, any> = {
  isVertical: true,
  labelPlacement: 'left',
  labelWidth: 80,
  formItems: [
    {
      field: "id",
      labelName: "id",
      labelStyle: "fontSize:14px;",
      type: "Input",
      inputType: "text",
      inputWidth: "180px",
      disabled:true,
      span: 24
    },
    {
      field: "TYPE",
      labelName: "类别",
      labelStyle: "fontSize:14px;",
      type: "Input",
      inputType: "text",
      inputWidth: "180px",
      placeholder: "请输入类别",
      span: 24
    },
  ],
  rules: {
    TYPE: {
      required: true,
      trigger: ["input"],
      message: "请输入类别",
      validator(rule: FormItemRule, value: string) {
        if (value.length === 0) {
          return new Error("未输入类别");
        }
        return true;
      },
    },
   
  },
};

